import ajax from '../utils/axios';

// 打卡

export async function getHistoryClock(params) {
  // interface params {
    // month: string; 2023-03
  // }
  const res = await ajax.get(`/clock/history`, { params });
  return res.data.data;
}

export async function clock(params) {
  // interface params {
    // clock_address: string;
    // clock_remark:  string;
    // clock_time:    string;
    // clock_type:    number;
    // /**
    //  * 打卡表id
    //  */
    // id: string;
  // }
  const res = await ajax.post(`/clock`,  params );
  return res.data.data;
}



export async function clockRule() {
  const res = await ajax.get(`/staff/clock_rule`);
  return res.data.data;
}

export async function editClockRule(params) {
  // interface params {
    // clock_in_time:  string;
    // clock_out_time: string;
  // }
  const res = await ajax.put(`/staff/clock_rule`,params);
  return res.data.data;
}


export async function getClockType() {
  const res = await ajax.get(`/clock/clock_types`);
  return res.data.data;
}

export async function getTodayClock() {
  const res = await ajax.get(`/clock/today`);
  return res.data.data;
}

export async function getAttendanceTypes() {
  const res = await ajax.get(`/staff/attendance_types`);
  return res.data.data;
}




